<?php
namespace PsiFramework\Applications\AlloMediaPortal\Classes\Model;

import("Classes.Model.Object");

use \PsiFramework\Classes\Model\Object;

/**
 * AlloMedia
 * Portail des professionnels
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'un site web allomedia
 *
 * @package Model
 */
class AlloMediaSite extends Object
{

    protected /*int*/                $_id ;
    protected /*string*/             $_name;
    protected /*string*/             $_uri;
    protected /*string*/             $_categoryDefaultText ;
    protected /*InformationProfile*/ $_profile ;
    protected /*Style*/              $_style ;
    protected /*string*/             $_gauge ;
    protected /*CategoryLink*/       $_categories ;
    protected /*SiteMembership[]*/   $_entries;

    /**
     * Constructeur
     *
     * @param  int            $id                  L'identifiant du site
     * @param  string         $name                Le nom du site
     * @param  string         $uri                 L'uri du site
     * @param  string         $categoryDefaultText Le texte par défaut
     *                                             de la catégorie
     * @param  CategoryLink[] $categories          Les categories du site
     */
    public function __construct(
        /*int*/ $id=null,
        /*string*/ $name=null,
        /*string*/ $uri=null,
        /*string*/ $categoryDefaultText=null,
        /*CategoryLink[]*/ $categories=null,
        /*SiteMembership[]*/ $entries=null
    )
    {
        $this->_id = $id ;
        $this->_name = $name ;
        $this->_uri = $uri ;
        $this->_categories = $categories ;
        $this->_entries = $entries ;
        $this->_profile = null ;
        $this->_style = null ;
        $this->_gauge = null ;
    }

    public function getId()
    {
        return $this->_id ;
    }

    public function setId($id)
    {
        $this->_id = $id ;
    }

    public function getName()
    {
        return $this->_name ;
    }

    public function setName($name)
    {
        $this->_name = $name ;
    }

    public function getUri()
    {
        return $this->_uri ;
    }

    public function setUri($uri)
    {
        $this->_uri = $uri ;
    }

    public function getCategoryDefaultText()
    {
        return $this->_categoryDefaultText ;
    }

    public function setCategoryDefaultText($categoryDefaultText)
    {
        $this->_categoryDefaultText = $categoryDefaultText ;
    }

    public function getProfile()
    {
        return $this->_profile ;
    }

    public function setProfile($profile)
    {
        $this->_profile = $profile ;
    }

    public function getStyle()
    {
        return $this->_style ;
    }

    public function setStyle($style)
    {
        $this->_style = $style ;
    }

    public function getGauge()
    {
    	return $this->_gauge ;
    }
    
    public function setGauge($gauge)
    {
    	$this->_gauge = $gauge ;
    }
    
    public function getCategories()
    {
        return $this->_categories ;
    }

    public function setCategories($categories)
    {
        $this->_categories = $categories ;
    }

    public function AddCategory($category)
    {
        if (is_null($this->_categories)) {
        	$this->_categories = array();
        }
        $this->_categories[] = $category ;
    }

    public function getEntries()
    {
        return $this->_entries ;
    }

    public function setEntries($entries)
    {
        $this->_entries = $entries ;
    }

    public function AddEntry($entry)
    {
        if (is_null($this->_entries)) {
        	$this->_entries = array();
        }
        $this->_entries[] = $entry ;
    }

    public function toString()
    {
        $string = $this->_name . ' (' . $this->_uri . ')' ;
        if ($this->_categories != null) {
            foreach ($this->_categories as $category) {
                $string .= " (" . $category->toString() . ") " ;
            }
        }
        return $string ;
    }
}
